package com.base.cn.platform.os.common;

import com.base.cn.platform.os.common.utils.ObjectUtils;
import com.base.cn.platform.os.common.utils.StringUtils;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/** 处理OP中的数据工具类
 * @Author zjh
 * @Description //TODO
 * @Date 2018/10/18 14:04
 */
public class OpDataManage {

    /**
     *
     * @param course
     * @return
     */
    public static String getCourseId(String course){
        String  courseIds ="";
        if (StringUtils.isNotEmpty(course)) {
            String[] courseIdArray = StringUtils.subHeadTailString(course, ",").split(",");
            if (ObjectUtils.isNotEmpty(courseIdArray)) {
                List<String> courseIdList = Arrays.asList(courseIdArray);
                if (ObjectUtils.isNotEmpty(courseIdList)) {
                    courseIds = courseIdList.stream().distinct().collect(Collectors.joining(","));
                }
            }
        }
        return  courseIds;
    }
}
